package lagou.cn.homework

object beer {
  def main(args: Array[String]): Unit = {
    //第一次买几瓶
    var one:Int = 100/2
    var two = process(0,one,one)
    println(s"一共喝酒瓶数：${one+two}")
  }

  def process(sum:Int,bottle:Int,cap:Int):Int ={
    if (bottle<3 && cap<5) return sum
    var a1 = bottle/3
    var a2 = bottle%3
    var b1 = cap/5
    var b2 = cap%5
    println(f"总数=${a1+b1+sum} 上次剩余瓶子=${a1+b1+a2}%02d 上次剩余瓶盖=${a1+b1+b2}%02d")
    return process(a1+b1+sum,a1+b1+a2,a1+b1+b2)
  }
}
